#include <iostream>
#include <vector>
#include <map>
using namespace std;

class RangeFreqQuery
{
private:
    map<int, vector<int>> mp;

public:
    RangeFreqQuery(vector<int> &arr)
    {
        for (int i = 0; i < arr.size(); i++)
        {
            mp[arr[i]].push_back(i);
        }
    }

    int query(int left, int right, int value)
    {
        if (mp.count(value))
        {
            auto it = lower_bound(mp[value].begin(), mp[value].end(), left);
            auto it2 = upper_bound(mp[value].begin(), mp[value].end(), right);
            return it2 - it;
        }
        return 0;
    }
};
int main()
{
    cout << "Code2080" << endl;
    RangeFreqQuery s = RangeFreqQuery(vector<int>{1, 2, 2, 2, 2});
    cout << s.query(0, 4, 2) << endl;
    return 0;
}